%%
%% This is file `xparse.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xparse.dtx  (with options: `package')
%% 
%% Copyright (C) 2009-2025 The LaTeX Project
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% This file is part of the "l3packages bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: xparse.dtx
\RequirePackage{expl3}[2018-04-12]
\@ifpackagelater{expl3}{2018-04-12}
  {}
  {%
    \PackageError{xparse}{Support package l3kernel too old}
      {%
        Please install an up to date version of l3kernel\MessageBreak
        using your TeX package manager or from CTAN.\MessageBreak
        \MessageBreak
        Loading xparse will abort!%
      }%
    \endinput
  }
\ExplSyntaxOn
\cs_set_protected:Npn \__cmd_tmp:w #1
  {
    \DeclareOption* { \PassOptionsToPackage { \CurrentOption } {#1} }
    \ProcessOptions \relax
    \RequirePackage {#1}
  }
\cs_if_free:NTF \NewDocumentCommand
  {
    \ExplSyntaxOff
    \ifnum\expandafter
        \@parse@version\fmtversion//00\@nil <
        \@parse@version 2020-10-01//00\@nil
      \__cmd_tmp:w { xparse-2018-04-12 }
    \else
      \__cmd_tmp:w { xparse-2020-10-01 }
    \fi
    \file_input_stop:
  }
  {
    \ExplSyntaxOff
    \cs_if_exist:NF \__cmd_start:nNNnnn
      {
        \__cmd_tmp:w { xparse-2020-10-01 }
        \file_input_stop:
      }
  }
\ExplSyntaxOff
\ProvidesExplPackage{xparse}{2025-10-09}{}
  {L3 Experimental document command parser}
\clist_new:N \l__cmd_options_clist
\DeclareOption* { \clist_put_right:NV \l__cmd_options_clist \CurrentOption }
\ProcessOptions \relax
\cs_set_protected:Npn \__cmd_tmp:w #1
  {
    \keys_define:nn {#1}
      {
        log-declarations .bool_set:N = \l__cmd_log_bool ,
        log-declarations .initial:n  = false
      }
    \keys_set:nV {#1} \l__cmd_options_clist
    \bool_if:NTF \l__cmd_log_bool
      { \msg_redirect_module:nnn {#1} { info } { } }
      { \msg_redirect_module:nnn {#1} { info } { none } }
    \cs_new_protected:Npn \__cmd_unknown_argument_type_error:n ##1
      {
        \msg_error:nnee {#1} { unknown-argument-type }
          { \__cmd_environment_or_command: } { \tl_to_str:n {##1} }
      }
  }
\msg_if_exist:nnTF { cmd } { define-command }
  { \__cmd_tmp:w { cmd } }
  { \__cmd_tmp:w { ltcmd } }
\cs_gset_protected:Npn \__cmd_normalize_arg_spec_loop:n #1
  {
    \quark_if_recursion_tail_stop:n {#1}
    \int_incr:N \l__cmd_current_arg_int
    \cs_if_exist_use:cF { __cmd_normalize_type_ \tl_to_str:n {#1} :w }
      {
        \__cmd_unknown_argument_type_error:n {#1}
        \__cmd_bad_def:wn
      }
  }
\cs_new_protected:Npe \__cmd_normalize_type_g:w
  { \exp_not:N \__cmd_normalize_type_G:w { \exp_not:V \c_novalue_tl } }
\cs_new_protected:Npn \__cmd_normalize_type_G:w #1
  {
    \quark_if_recursion_tail_stop_do:nn {#1} { \__cmd_bad_arg_spec:wn }
    \__cmd_normalize_check_gv:N G
    \__cmd_add_arg_spec:n { G {#1} }
    \tl_put_right:Nn \l__cmd_last_delimiters_tl { { } }
    \__cmd_normalize_arg_spec_loop:n
  }
\cs_new_protected:Npn \__cmd_normalize_type_l:w
  {
    \__cmd_normalize_check_lu:N l
    \__cmd_add_arg_spec_mandatory:n { l }
    \__cmd_normalize_arg_spec_loop:n
  }
\cs_new_protected:Npn \__cmd_normalize_type_u:w #1
  {
    \quark_if_recursion_tail_stop_do:nn {#1} { \__cmd_bad_arg_spec:wn }
    \__cmd_normalize_check_lu:N u
    \__cmd_add_arg_spec_mandatory:n { u {#1} }
    \__cmd_normalize_arg_spec_loop:n
  }
\cs_new_protected:Npn \__cmd_add_type_G:w #1
  {
    \__cmd_flush_m_args:
    \__cmd_add_default:n {#1}
    \__cmd_add_grabber:N G
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_add_type_l:w
  {
    \__cmd_flush_m_args:
    \__cmd_add_default:
    \__cmd_add_grabber:N l
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_add_type_u:w #1
  {
    \__cmd_flush_m_args:
    \__cmd_add_default:
    \__cmd_add_grabber:N u
    \tl_put_right:Nn \l__cmd_signature_tl { {#1} }
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_add_expandable_type_l:w
  { \__cmd_add_expandable_type_u:w ## }
\cs_new_protected:Npn \__cmd_add_expandable_type_u:w #1
  {
    \__cmd_add_default:
    \bool_if:NTF \l__cmd_long_bool
      { \cs_set:cpn }
      { \cs_set_nopar:cpn }
      { \l__cmd_expandable_aux_name_tl } ##1 \q__cmd ##2 ##3 ##4 #1
      { ##1 {##4} \q__cmd ##2 ##3 }
    \__cmd_add_expandable_grabber:nn { u }
      { \exp_not:c  { \l__cmd_expandable_aux_name_tl } }
    \__cmd_prepare_signature:N
  }
\cs_new_protected:Npn \__cmd_copy_grabber_u:w #1 #2 #3
  { \__cmd_copy_grabber_D:w {#1} {#2} {#3} { } { } }
\tl_const:Nn \c__cmd_show_type_u_tl { 3 }
\tl_const:Nn \c__cmd_show_type_G_tl { 3 }
\cs_new_protected:Npn \__cmd_grab_G:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
      \__cmd_peek_nonspace:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_long:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected:Npn
      \__cmd_peek_nonspace:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_obey_spaces:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
      \peek_meaning:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_long_obey_spaces:w #1 \__cmd_run_code:
  {
    \__cmd_grab_G_aux:nNN {#1} \cs_set_protected:Npn
      \peek_meaning:NTF
  }
\cs_new_protected:Npn \__cmd_grab_G_aux:nNN #1#2#3
  {
    \tl_set:Nn \l__cmd_signature_tl {#1}
    \exp_after:wN #2 \l__cmd_fn_tl ##1
      { \__cmd_add_arg:n {##1} }
    #3 \c_group_begin_token
      { \l__cmd_fn_tl }
      { \__cmd_add_arg:o \c_novalue_tl }
  }
\cs_new_protected:Npn \__cmd_grab_l:w #1 \__cmd_run_code:
  { \__cmd_grab_l_aux:nN {#1} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \__cmd_grab_l_long:w #1 \__cmd_run_code:
  { \__cmd_grab_l_aux:nN {#1} \cs_set_protected:Npn }
\cs_new_protected:Npn \__cmd_grab_l_aux:nN #1#2
  {
    \tl_set:Nn \l__cmd_signature_tl {#1}
    \exp_after:wN #2 \l__cmd_fn_tl ##1##
      { \__cmd_add_arg:n {##1} }
    \l__cmd_fn_tl
  }
\cs_new_protected:Npn \__cmd_grab_u:w #1#2 \__cmd_run_code:
  { \__cmd_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \__cmd_grab_u_long:w #1#2 \__cmd_run_code:
  { \__cmd_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn }
\cs_new_protected:Npn \__cmd_grab_u_aux:nnN #1#2#3
  {
    \tl_set:Nn \l__cmd_signature_tl {#2}
    \exp_after:wN #3 \l__cmd_fn_tl ##1 #1
      { \__cmd_add_arg:n {##1} }
    \l__cmd_fn_tl
  }
\cs_new_eq:NN \__cmd_expandable_grab_u:w \prg_do_nothing:
\cs_gset_protected:Npn \__cmd_get_arg_spec_error:N #1
  {
    \bool_set_false:N \l__cmd_environment_bool
    \tl_set:Nn \l__cmd_fn_tl {#1}
    \__cmd_get_arg_spec_error_aux:n { \cs_if_exist:NTF #1 }
  }
\cs_gset_protected:Npn \__cmd_get_arg_spec_error:n #1
  {
    \bool_set_true:N \l__cmd_environment_bool
    \str_set:Ne \l__cmd_environment_str {#1}
    \__cmd_get_arg_spec_error_aux:n
      { \cs_if_exist:cTF { \l__cmd_environment_str } }
  }
\cs_gset_protected:Npn \__cmd_get_arg_spec_error_aux:n #1
  {
    #1
      {
        \msg_error:nne { cmd } { non-xparse }
          { \__cmd_environment_or_command: }
      }
      {
        \msg_error:nne { cmd } { unknown }
          { \__cmd_environment_or_command: }
      }
  }
\cs_gset_protected:Npn \__cmd_get_arg_spec:NTF #1#2#3
  {
    \__kernel_cmd_if_xparse:NTF #1
      {
        \tl_set:Ne \ArgumentSpecification
          {
            \exp_args:No \tl_if_head_eq_meaning:nNTF {#1} \__cmd_start_optimized:
              {
                \prg_replicate:nn
                  {
                    \str_count:e
                      {
                        \exp_args:Nc \cs_parameter_spec:N
                          { \cs_to_str:N #1 \c_space_tl code }
                      } / 2
                  }
                  {
                    \exp_args:Nc \token_if_protected_long_macro:NTF
                      { \cs_to_str:N #1 \c_space_tl code }
                      { + }
                      {
                        \exp_args:Nc \token_if_long_macro:NT
                        { \cs_to_str:N #1 \c_space_tl code }
                        { + }
                      }
                    m
                  }
              }
              { \tl_item:Nn #1 { 2 } }
          }
        #2
      }
      {#3}
  }
\tl_clear_new:N \ArgumentSpecification
\cs_gset_protected:Npn \__cmd_get_arg_spec:N #1
  {
    \__cmd_get_arg_spec:NTF #1 { }
      { \__cmd_get_arg_spec_error:N #1 }
  }
\cs_gset_protected:Npn \__cmd_get_arg_spec:n #1
  {
    \exp_args:Nc \__cmd_get_arg_spec:NTF
      { environment~ \tl_to_str:n {#1} }
      { }
      { \__cmd_get_arg_spec_error:n {#1} }
  }
\cs_gset_protected:Npn \__cmd_show_arg_spec:N #1
  {
    \__cmd_get_arg_spec:NTF #1
      { \tl_show:N \ArgumentSpecification }
      { \__cmd_get_arg_spec_error:N #1 }
  }
\cs_gset_protected:Npn \__cmd_show_arg_spec:n #1
  {
    \exp_args:Nc \__cmd_get_arg_spec:NTF
      { environment~ \tl_to_str:n {#1} }
      { \tl_show:N \ArgumentSpecification }
      { \__cmd_get_arg_spec_error:n {#1} }
  }
\cs_gset_protected:Npn \GetDocumentCommandArgSpec #1
  {
    \__cmd_check_definable:nNT {#1} \GetDocumentCommandArgSpec
      { \__cmd_get_arg_spec:N #1 }
  }
\cs_gset_eq:NN \GetDocumentEnvironmentArgSpec \__cmd_get_arg_spec:n
\cs_gset_protected:Npn \ShowDocumentCommandArgSpec #1
  {
    \__cmd_check_definable:nNT {#1} \ShowDocumentCommandArgSpec
      { \__cmd_show_arg_spec:N #1 }
  }
\cs_gset_eq:NN \ShowDocumentEnvironmentArgSpec \__cmd_show_arg_spec:n
\msg_set:nnnn { cmd } { non-xparse }
  { \str_uppercase:n #1~not~defined~using~xparse. }
  {
    You~have~asked~for~the~argument~specification~for~the~#1,~
    but~this~was~not~defined~using~xparse.
  }
\msg_set:nnnn { cmd } { unknown }
  { Unknown~document~#1. }
  {
    You~have~asked~for~the~argument~specification~for~the~#1,~
    but~it~is~not~defined.
  }
%% 
%%
%% End of file `xparse.sty'.
